Repository navigation
Share links: the compact ?p= form (raw deflate, base64url); «Zum Lesen» - #40
Merged
Merged
Conversation
«Teilen» writes the payload (unchanged, field for field) compressed with raw deflate (fflate, level 9) in base64url without padding as ?p= (#p= beyond 8,192 characters): about 40 % shorter, a hand-in of 1,980 characters becomes 1,185. ?project= links (lz-string) are read forever. fflate is synchronous, so «Teilen» still copies within the tap (iPad). The README documents the format with a zlib test vector, which test:browser opens. The drawer lists files by URL that aren't Python (a task's instructions) under «Zum Lesen», Python files under «Bibliotheken». Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P46: shorter share links, and a drawer heading for files to read.
1. The compact share link
?p=What changes: «Teilen» writes the same JSON payload as before, field for field:
v,name,mainFile,openFile,readOnlyandfilesin tab order. Only the encoding changes:A–Z a–z 0–9 - _), without=padding.?p=, or#p=when path and query would exceed 8,192 characters.Reading:
?p=/#p=and the old?project=/#project=(lz-string), with no end date.pshows the usual «Dieser Link ist unvollständig oder beschädigt …».Why fflate rather than
CompressionStream:CompressionStreamis asynchronous. On an iPad, «Teilen» must write the clipboard inside the tap's own handler, so building the link has to be synchronous. That's why I used fflate 0.8.3 (MIT, synchronous, level 9). It writes the same format, and the old-form fallback isn't needed since fflate works in every browser. Any raw deflate stream reads, e.g. Node'szlib.deflateRawSync, whose bytes differ from fflate's for the same payload.Numbers (the Etappe-4-shaped hand-in:
aufgabe.mdandparser.pyby URL,auswerter.pywith docstrings):?project=(lz-string)?p=, fflate (the IDE)?p=, zlib level 9 (e.g. a course script)The 2,083 note is measured on the new link, as before.
Test vector (in the README too;
test:browserchecks it):{"v":1,"name":"Test","mainFile":"main.py","files":{"main.py":{"path":"main.py","label":"main","kind":"python","code":"print(\"Grüezi\")\n"}}}These exact bytes, as
JSON.stringifywrites them, go throughzlib.deflateRawSync(Buffer.from(json, 'utf8'), { level: 9 }).toString('base64url'), which givesso
https://glpython-edu.github.io/?p=+ that opensmain.pywithprint("Grüezi").2. «Zum Lesen» in the drawer
Files loaded by URL are now grouped by kind:
aufgabe.md, under Zum Lesen (en: To read).I chose the split over one neutral «Schreibgeschützt»: «Bibliotheken» says what a
parser.pyis for, and «Zum Lesen» says what to do with the instructions.Checks (
test:browser, all 21 pass)New cases:
aufgabe.mdby URL asopenFile, tab order, an edit inauswerter.py), then «Teilen» and opening the result.?p=[A-Za-z0-9_-]+.aufgabe.md, with the same tab order and the same code andreadOnlyfor every file.?project=and#project=links open as before.?p=link cut to 60 % shows the notice and an empty project.bib.pyunder «Bibliotheken»,aufgabe.mdunder «Zum Lesen».WebKit (Safari's engine), with an iPad profile (Playwright, not on a real iPad): a zlib-written
?p=link with umlauts and an emoji opens on itsopenFile. «Teilen» writes?p=, which reads back identically.Lint passes (only the existing warnings in
coi-serviceworker.js), and so does the build.THIRD_PARTY_NOTICES.mdlists fflate.Going live
?p=.?p=), and a course patch bump. If the macro went first, a course's?p=link would open an empty project in the old IDE.Manual tests
Desktop (Chrome, Safari, Firefox):
?project=): opens as before.https://glpython-edu.github.io/?p=and is clearly shorter. Opening it in a new tab gives the same project and open tab.aufgabe.mdby URL: the drawer shows «Zum Lesen» with the book icon and the lock.iPad (Safari, external keyboard):
Follow-ups (not done)
label,kind,path,readOnlyon URLs) would save another 5–10 %. You asked me not to build it for now.?p=. Only an IDE tab left open from before the deploy is affected, and it offers to reload.🤖 Generated with Claude Code